<template>
  <div>
    <input type="text" placeholder="Enter color code" v-model="colorCode" />
  </div>
</template>

<script>
import { computed } from 'vue'
import { useStore } from 'vuex'

export default {
  setup() {
    const store = useStore()

    const colorCode = computed({
      get() {
        return store.state.colorCode
      },
      set(newVal) {
        store.dispatch('setColorCode', newVal)
      }
    })

    return { colorCode }
  }
}
</script>

<style>
</style>
